﻿<?xml version="1.0" encoding="utf-8"?>
<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:vm="clr-namespace:SkyShell.ViewModel" xmlns:Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" x:Class="SkyShell.App" StartupUri="MainWindow.xaml" mc:Ignorable="d" xmlns:my="clr-namespace:SkyShell.Assets">
  <Application.Resources>
    <ResourceDictionary>
      <vm:ViewModelLocator x:Key="Locator" d:IsDataSource="True" />
    	<Style x:Key="ButtonFocusVisual">
    		<Setter Property="Control.Template">
    			<Setter.Value>
    				<ControlTemplate>
    					<Rectangle Margin="2" SnapsToDevicePixels="true" Stroke="Black" StrokeThickness="1" StrokeDashArray="1 2"/>
    				</ControlTemplate>
    			</Setter.Value>
    		</Setter>
    	</Style>
            <Style TargetType="{x:Type TextBox}">
                <Setter Property="Validation.ErrorTemplate">
                    <Setter.Value>
                        <ControlTemplate>
                            <DockPanel LastChildFill="True">
                                <TextBlock DockPanel.Dock="Bottom"
                        Foreground="Red"
                        FontSize="12pt"
                        Text="{Binding ElementName=MyAdorner, 
                               Path=AdornedElement.(Validation.Errors)[0].ErrorContent}">
                                </TextBlock>
                                <Border BorderBrush="Red" BorderThickness="1">
                                    <AdornedElementPlaceholder Name="MyAdorner" />
                                </Border>
                            </DockPanel>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        
            <LinearGradientBrush x:Key="ButtonNormalBackground" EndPoint="0,1" StartPoint="0,0">
    		<GradientStop Color="#F3F3F3" Offset="0"/>
    		<GradientStop Color="#EBEBEB" Offset="0.5"/>
    		<GradientStop Color="#DDDDDD" Offset="0.5"/>
    		<GradientStop Color="#CDCDCD" Offset="1"/>
    	</LinearGradientBrush>
    	<SolidColorBrush x:Key="ButtonNormalBorder" Color="#FF707070"/>
    	<Style x:Key="ButtonStyleSelection" TargetType="{x:Type Button}">
    		<Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>
    		<Setter Property="Background" Value="White"/>
    		<Setter Property="BorderThickness" Value="1"/>
    		<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
    		<Setter Property="HorizontalContentAlignment" Value="Center"/>
    		<Setter Property="VerticalContentAlignment" Value="Center"/>
    		<Setter Property="Padding" Value="1"/>
    		<Setter Property="Template">
    			<Setter.Value>
    				<ControlTemplate TargetType="{x:Type Button}">
    					<Themes:ButtonChrome x:Name="Chrome" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" SnapsToDevicePixels="true" Opacity="1">
    						<VisualStateManager.VisualStateGroups>
    							<VisualStateGroup x:Name="CommonStates">
    								<VisualState x:Name="Normal"/>
    								<VisualState x:Name="MouseOver">
    									<Storyboard>
    										<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="contentPresenter">
    											<EasingDoubleKeyFrame KeyTime="0" Value="1"/>
    										</DoubleAnimationUsingKeyFrames>
    									</Storyboard>
    								</VisualState>
    								<VisualState x:Name="Pressed"/>
    								<VisualState x:Name="Disabled"/>
    							</VisualStateGroup>
    							<VisualStateGroup x:Name="FocusStates"/>
    							<VisualStateGroup x:Name="ValidationStates"/>
    						</VisualStateManager.VisualStateGroups>
    						<ContentPresenter x:Name="contentPresenter" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Opacity="0.695"/>
    					</Themes:ButtonChrome>
    					
    				</ControlTemplate>
    			</Setter.Value>
    		</Setter>
    		<Setter Property="BorderBrush" Value="{x:Null}"/>
    	</Style>
      <my:VisibilityConverter x:Key="VisibilityConverter" />
      <my:IsNullVisibilityConverter x:Key="IsNullVisibilityConverter" />
      <Style x:Key="ButtonStyleChromeless" TargetType="{x:Type Button}">
      	<Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>
      	<Setter Property="Background" Value="{StaticResource ButtonNormalBackground}"/>
      	<Setter Property="BorderBrush" Value="{StaticResource ButtonNormalBorder}"/>
      	<Setter Property="BorderThickness" Value="1"/>
      	<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
      	<Setter Property="HorizontalContentAlignment" Value="Center"/>
      	<Setter Property="VerticalContentAlignment" Value="Center"/>
      	<Setter Property="Padding" Value="1"/>
      	<Setter Property="Template">
      		<Setter.Value>
      			<ControlTemplate TargetType="{x:Type Button}">
      					<ContentPresenter x:Name="contentPresenter" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Opacity="0.745" RenderTransformOrigin="0.5,0.5">
      						<ContentPresenter.RenderTransform>
      							<TransformGroup>
      								<ScaleTransform/>
      								<SkewTransform/>
      								<RotateTransform/>
      								<TranslateTransform/>
      							</TransformGroup>
      						</ContentPresenter.RenderTransform>
      						<VisualStateManager.VisualStateGroups>
      							<VisualStateGroup x:Name="CommonStates">
      								<VisualState x:Name="Normal"/>
      								<VisualState x:Name="MouseOver">
      									<Storyboard>
      										<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="contentPresenter">
      											<EasingDoubleKeyFrame KeyTime="0" Value="0.895"/>
      										</DoubleAnimationUsingKeyFrames>
      									</Storyboard>
      								</VisualState>
      								<VisualState x:Name="Pressed">
      									<Storyboard>
      										<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="contentPresenter">
      											<EasingDoubleKeyFrame KeyTime="0" Value="1"/>
      										</DoubleAnimationUsingKeyFrames>
      										<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="contentPresenter">
      											<EasingDoubleKeyFrame KeyTime="0" Value="0.95"/>
      										</DoubleAnimationUsingKeyFrames>
      										<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="contentPresenter">
      											<EasingDoubleKeyFrame KeyTime="0" Value="0.9"/>
      										</DoubleAnimationUsingKeyFrames>
      									</Storyboard>
      								</VisualState>
      								<VisualState x:Name="Disabled"/>
      							</VisualStateGroup>
      							<VisualStateGroup x:Name="FocusStates"/>
      							<VisualStateGroup x:Name="ValidationStates"/>
      						</VisualStateManager.VisualStateGroups>
      					</ContentPresenter>
      			</ControlTemplate>
      		</Setter.Value>
      	</Setter>
      </Style>
    </ResourceDictionary>
  </Application.Resources>
</Application>